home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / appkit.346 < prev    next >
Text File  |  1992-02-06  |  867b  |  28 lines

  1. read tiff NXReadTIFF result alpha channel
  2.  
  3. Q: Where's the pointer to the alpha channel in a TIFF file read by
  4. NXReadTIFF?
  5.  
  6.  
  7. A: If you use NXReadTIFF to read a tiff file that has data and alpha channels, the return value is the pointer to the data channel.  Where is the pointer to the alpha channel?  The answer is at the data plus stripByteCounts[0].   The following code fragment demonstrates:
  8.  
  9.     void *tiffData;
  10.     NXTIFFInfo tiffInfo;
  11.  
  12.     tiffData = NXReadTIFF(0,stream,&tiffInfo,NULL);
  13.     <<assuming we know spp is 2 and pi is 5>>
  14.     NXImageBitmap(&contentRect,tiffInfo.image.width,
  15.         tiffInfo.image.height,tiffInfo.image.bitsPerSample,
  16.         tiffInfo.image.samplesPerPixel,tiffInfo.image.planarConfig,
  17.         tiffInfo.image.photoInterp,
  18.         tiffData,
  19.         ((char *)tiffData) + tiffInfo.stripByteCounts[0],
  20.         0,0,0);
  21.  
  22. QA346
  23.  
  24. Valid for 1.0 
  25. Not checked yet for 2.0 
  26.  
  27.  
  28.